﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Visifire.Charts;

namespace Intel_Client_GUI
{

	public partial class Process
	{
		public Process()
		{
			this.InitializeComponent();
			// 在此点之下插入创建对象所需的代码。	
		}

        private void DataSeries_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            //System.Windows.MessageBox.Show(sender.ToString());
            var p = this.FindResource("ProcessDataSource") as ProcessViewModel;
            var dp = sender as DataPoint;
            if(p==null||dp==null)
                return;
			
			if(this.ExplodedPoint!=null)
			{
				try
				{
					this.ExplodedPoint.Exploded=false;
				}
				catch
				{
					this.ExplodedPoint=null;
				}
			}
			dp.Exploded = true;
			this.ExplodedPoint=dp;
            p.ShowSubChart(dp.AxisXLabel);
        }
		
		

		private void DataSeries_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
		{
			// 在此处添加事件处理程序实现。
			var dp = sender as DataPoint;
            if (dp == null)
                return;
            this.ProcessName.Text = dp.AxisXLabel;
            this.TotalOperations.Text = dp.YValue.ToString();
            this.PerdayOps.Text = (dp.YValue / Globle.DateTimeData.TimeAndDuration.duration.Days).ToString();
        }
		
		private DataPoint ExplodedPoint = null;



       

	}
}